<template>
  <div class="page-home">
    <van-nav-bar :title="title" />

    <div class="page-home__view" ref="homeView">
      <keep-alive>
        <router-view></router-view>
      </keep-alive>
    </div>

    <van-tabbar class="page-home__tabbar" route>
      <van-tabbar-item icon="wap-home-o" to="/posts" replace>首页</van-tabbar-item>
      <van-tabbar-item icon="add-o" to="/add" replace>创作</van-tabbar-item>
      <van-tabbar-item icon="manager-o" to="/center" replace>我</van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<script>
import { mapState } from "vuex";

export default {
  name: "Home",

  provide() {
    return {
      home: this
    };
  },

  computed: {
    ...mapState(["title"])
  }
};
</script>

<style lang="scss">
.page-home {
  display: flex;
  flex-direction: column;
  height: 100%;
  &__view {
    flex: 1;
    overflow-y: auto;
  }
  &__tabbar {
    position: relative;
  }
}
</style> 
